#ifndef __paint_h__
#define __paint_h__

#include "define.h"
#include "style.h"

class FacePainterImpl
{
public:
    FacePainterImpl();
    virtual ~FacePainterImpl();

    void SetContext( core::canvas canvas );

public:
    virtual int SetClipRect( const core::rect &rect )
    {
        return 0;
    }

    virtual bool ClearClipRect( int clip )
    {
        return false;
    }

    virtual void DrawRectangle
              (
                const core::rect &rect,
                core::dword style,
                core::color color,
                int alpha
               )
    {
    }

    virtual void FillRectangle
              (
                const core::rect &rect,
                core::color color,
                int alpha
               )
    {
    }

    virtual void DrawImage
              (
                const std::wstring &file,
                const core::rect &rect,
                int alpha
               )
    {
    }

    virtual void DrawGridImage
              (
                const std::wstring &file,
                const core::rect &rect,
                const core::rect &grid,
                int length,
                int index,
                int alpha
               )
    {
    }

    virtual void SetTextFont
              (
                const std::wstring &family,
                const core::unit &size,
                core::dword format
               )
    {
    }

    virtual void DrawString
              (
                const std::wstring &text,
                const core::rect &rect,
                core::color color,
                core::dword align,
                int alpha
               )
    {
    }

    virtual int GetCharacterPosition
              (
                const std::wstring &text,
                int &width
               )
    {
        return 0;
    }

protected:
    core::canvas      canvas_;

private:
    DISABLE_COPY_AND_ASSIGN(FacePainterImpl)
};

class FacePainter
{
public:
    FacePainter( core::canvas canvas );
    virtual ~FacePainter();

public:
    virtual int SetClipRect
              (
                const core::rect &rect
               );

    virtual bool ClearClipRect( int clip );

    virtual void DrawBorder
              (
                const core::rect &rect,
                core::dword border_style,
                int border_width,
                core::color border_color,
                int alpha
               );

    virtual void DrawBackground
              (
                const core::rect &rect,
                core::color background_color,
                int alpha
               );

    virtual void DrawImage
              (
                const std::wstring &file,
                const core::rect &rect,
                int alpha
               );

    virtual void DrawGridImage
              (
                const std::wstring &file,
                const core::rect &rect,
                const core::rect &grid,
                int length,
                int index,
                int alpha
               );

    virtual void DrawString
              (
                const std::wstring &text,
                const core::rect &rect,
                const std::wstring &family,
                const core::unit &size,
                core::dword format,
                core::color color,
                core::dword align,
                int alpha
               );

    virtual int GetCharacterPosition
              (
                const std::wstring &text,
                int &width,
                const std::wstring &family,
                const core::unit &size,
                core::dword format
               );

protected:
    FacePainterImpl * impl_;
    core::canvas      canvas_;

protected:
    virtual FacePainterImpl * GetFacePainterImpl();

private:
    DISABLE_COPY_AND_ASSIGN(FacePainter)
};


#endif